This project contains a sample application built to localize against a location in London. It is expected that the users uses the Custom Location lens to produce a location group.
NOTE: This project will only work for the Spectacles platform.
Designing Lenses for Spectacles offers all-new possibilities to rethink user interaction with digital spaces and the physical world. Get started using our Design Guidelines
- Lens Studio: v5.15.0+
- Spectacles OS Version: v5.64+
- Spectacles App iOS: v0.64+
- Spectacles App Android: v0.64+
To update your Spectacles device and mobile app, refer to this guide.
You can download the latest version of Lens Studio from here.
To obtain the project folder, you need to clone the repository.
IMPORTANT: This project uses Git Large Files Support (LFS). Downloading a zip file using the green button on Github will not work. You must clone the project with a version of git that has LFS. You can download Git LFS here: https://git-lfs.github.com/.
The project as cloned has a working example scene, but it will require you to reconfigure it to a Custom Location Group of your choosing.
Further information about creating scans can be found here.
ActivateWhenInCameraView.ts: This script attaches to a LocatedAtComponent and calls activate and deactivate functions on attached listeners.
ScaleInLocatedObject.ts: This is an example script that scales in an object when the user approached.
At the physical location at which the AR content is anchored, create a series of scans for each of the main content areas.
Once the scans have been created and published, create a group including all of the scans. Stabilize each of the members of the group and publish the Custom Location Group.
Add a Custom Location Group to the scene hierarchy of your project and press "Reload Group".
- Open this project in Lens Studio
- Add an empty SceneObject to your scene hierarchy
- Add a
Custom Location Groupcomponent to the SceneObject - Add the ID of the scan to the "Group ID" field
- Click "Reload Group"
- On the SceneObject with the
CustomLocationGroupcomponent, addDeactivateLocationMeshOnDevice - On the SceneObject with the
LocatedAtcomponent of the first location- Parent the desired content and position relative to the scan mesh
- Create an empty scene object representing the center of the scan
- Attach the
ActivateWhenInCameraViewscript - Update references to the scene's main camera and the center SceneObject
- Add the
ScaleInLocatedObjectscript - Update references to the content and
LocatedAtcomponent - Add as a child an audio asset scene object
- Add the
AudioLocatedObjectto that object - Add both
LocatedObjectscripts to the "Listener Objects" field on the activate script
- Repeat this for all locations as appropriate
Add the content that is to be anchored to each of the locations.
The final lens with assets correctly parented can now be sent to Spectacles and tested at the scanned location.
Open the project and observe a pre-made Custom Location of an office. The statue in the center has an animated cat set to spawn on approach. Moving the camera preview window will simulate the approach of the user and the cat can be observed to appear and a sound effect is played.
Custom Locations are by nature attached to real places. To test this lens on device, the Custom Location Group will need to be changed. Following the guide linked at the start of this document, replace the Group ID on the SceneObject "LocationRoot" with a scan you have made; follow the instructions to recreate the parented assets to this new scan. Once completed, send the lens to the Spectacles, launch the new lens and move to the scanned location.
If you have any questions or need assistance, please don't hesitate to reach out. Our community is here to help, and you can connect with us and ask for support here. We look forward to hearing from you and are excited to assist you on your journey!
Feel free to provide improvements or suggestions or directly contributing via merge request. By sharing insights, you help everyone else build better Lenses.
Built with 👻 by the Spectacles team






